<mat-menubar>
  <mat-menubar-item [cdkMenuTriggerFor]="file">File</mat-menubar-item>
  <mat-menubar-item [cdkMenuTriggerFor]="edit">Edit</mat-menubar-item>
  <mat-menubar-item [cdkMenuTriggerFor]="view">View</mat-menubar-item>
</mat-menubar>

<ng-template #file>
  <demo-menu>
    <demo-menu-item>Share</demo-menu-item>
    <demo-menu-item>Open</demo-menu-item>
    <demo-menu-item>Make a Copy</demo-menu-item>
  </demo-menu>
</ng-template>

<ng-template #edit>
  <demo-menu>
    <demo-menu-item>Undo</demo-menu-item>
    <demo-menu-item>Redo</demo-menu-item>
  </demo-menu>
</ng-template>

<ng-template #view>
  <demo-menu>
    <demo-menu-item>Show Ruler</demo-menu-item>
    <demo-menu-item>Show Document Outline</demo-menu-item>
  </demo-menu>
</ng-template>
